<ui:composition
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:nxu="http://nuxeo.org/nxweb/util"
  xmlns:nxh="http://nuxeo.org/nxweb/html"
  xmlns:nxd="http://nuxeo.org/nxweb/document"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html">

<nxu:set var="fancyboxIdPrefix" value="#{idPrefix}#{nxu:jsfTagIdEscape(action.id)}_">

<nxd:restDocumentLink
  document="#{currentDocument}"
  addTabInfo="false"
  id="#{widget.id}_iframe"
  resolveOnly="true"
  view="suggest_add_new_directory_entry"
  var="iframe">
  <f:param name="directoryNameForPopup" value="#{directoryNameForPopup}" />
  <f:param name="postback" value="false" />

<c:if test="#{widget.mode != 'after_view' and widget.mode != 'tab_content'}">

  <f:subview id="#{fancyboxIdPrefix}subview">
  <nxu:set var="onclick"
    value="#{nxu:test(not empty action.properties.confirmMessage, actionConfirmMessageJs, '')}#{action.confirm};#{action.properties.onclick};"
    cache="true">

      <ui:decorate template="fancybox_properties_template.xhtml">
        <ui:define name="fancybox_properties_include">

          <nxu:set var="fancyboxJs"
            value="openFancyBox('#{nxu:javaScriptEscape(iframe)}', {
                    width: '#{fancy_width}',
                    height: '#{fancy_height}',
                    scrolling: '#{fancy_scrolling}',
                    autoScale: #{fancy_autoScale},
                    autoDimensions: #{fancy_autoDimensions},
                    modal: #{fancy_modal},
                    centerOnScroll: #{fancy_centerOnScroll},
                    enableEscapeButton: #{fancy_enableEscapeButton}
                  });">

            <c:if test="#{not widgetProperty_useButton}">
              <a4j:commandLink id="#{fancyboxIdPrefix}link"
                execute="@this"
                ignoreDupResponses="true" requestDelay="100"
                onclick="#{onclick};#{fancyboxJs}"
                disabled="#{!action.available}"
                styleClass="actionLink #{widgetProperty_actionStyleClass} #{action.properties.styleClass}"
                accesskey="#{action.accessKey}">
                <ui:include src="/incl/action/action_icon_label_template.xhtml">
                  <ui:param name="hideIcon" value="#{widgetProperty_hideIcon}" />
                  <ui:param name="hideLabel" value="#{widgetProperty_hideLabel}" />
                </ui:include>
                <ui:insert name="inside_action" />
              </a4j:commandLink>
            </c:if>

            <c:if test="#{widgetProperty_useButton}">
              <a4j:commandButton id="#{fancyboxIdPrefix}link"
                execute="@this"
                ignoreDupResponses="true" requestDelay="100"
                onclick="#{onclick};#{fancyboxJs}"
                value="#{messages[action.label]}"
                disabled="#{!action.available}"
                styleClass="button #{widgetProperty_actionStyleClass} #{action.properties.styleClass}"
                accesskey="#{action.accessKey}">
                <ui:insert name="inside_action" />
              </a4j:commandButton>
            </c:if>

          </nxu:set>
        </ui:define>
      </ui:decorate>

  </nxu:set>
  </f:subview>

</c:if>

</nxd:restDocumentLink>
</nxu:set>

</ui:composition>